public class SingletClass {


    private static volatile SingletClass instance = null;

    private SingletClass() {

    }

    public static SingletClass getInstance() {
        if (null == instance) {
            synchronized (SingletClass.class) {
                if (null == instance) {
                    instance = new SingletClass();
                }
            }
        }
        return instance;
    }

    public static void main(String[] args) {
        for (int i = 0; i < 100; i++) {
            final int intTemp = i;
            new Thread(() -> {
                System.out.println(SingletClass.getInstance());
            }, String.valueOf(intTemp)).start();
        }
    }
}
